﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TB_CS.DingTalk
{
    public partial class DingTalk_Config : Form
    {
        public DingTalk_Config()
        {
            InitializeComponent();
        }

        private void DingTalk_Config_Load(object sender, EventArgs e)
        {
            DataSet DK_Info_DST = Class.SysInfo.WSDK.GET_DingTalk_Info(Class.SysInfo.GET_Seller_Nick().ToString());
            if(DK_Info_DST.Tables[0].Rows.Count==0)
            {
                MessageBox.Show("您的系统暂未开通钉钉推送服务，请通过主管联系系统提供方开通", "警告");
            }
            else
            {
                textBox1.Text = DK_Info_DST.Tables[0].Rows[0][2].ToString();
                textBox2.Text = DK_Info_DST.Tables[0].Rows[0][3].ToString();
                textBox3.Text = DK_Info_DST.Tables[0].Rows[0][4].ToString();
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Class.SysInfo.WSDK.Update_DingTalk_Info(Class.SysInfo.GET_Seller_Nick().ToString(),
                textBox1.Text.Trim().ToString(), textBox2.Text.Trim().ToString(),
                textBox3.Text.Trim().ToString());
            MessageBox.Show("更新成功", "Success");
            this.Close();
        }
    }
}
